package com.ceair.flight.refund.location.dt.enums;

import java.util.Objects;

/**
 * 旅客状态枚举
 *
 * @author rujun
 *
 */
public enum PaxStatusEnum {

    WAIT_TICKET(1, "待开票"),
    TICKETED(2, "已开票"),
    REFUNDED(3, "已退票"),
    UPDATED(4, "已改期"),
    EXCHANGED(5, "已升舱"),
    SUSPENDED(6, "已挂起");

    /**
     * 简码
     */
    private final Integer code;

    /**
     * 描述
     */
    private final String description;

    private PaxStatusEnum(Integer code, String description) {
        this.code = code;
        this.description = description;
    }

    /**
     * @return Returns the code.
     */
    public Integer getCode() {
        return code;
    }

    /**
     * @return Returns the description.
     */
    public String getDescription() {
        return description;
    }

    /**
     * 通过枚举<code>code</code>获得枚举。
     *
     * @param code 简码
     * @return 枚举
     */
    public static PaxStatusEnum getByCode(Integer code) {
        for (PaxStatusEnum status : values()) {
            if (Objects.equals(status.getCode(), code)) {
                return status;
            }
        }
        return null;
    }
}
